package com.wmada.spring.dao;

import com.wmada.spring.bean.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

/**
 * @author will.ma
 * @date 2020-2-2
 */
public interface UserRepository extends JpaRepository<User, Long> {

    User findByUsername(String username);

    User findByEmail(String email);

    User findByPhone(String phone);

    User findByEmailAndIdNot(String email, Long id);

    User findByPhoneAndIdNot(String phone, Long id);

    User findByUsernameOrEmail(String username, String email);

    Page<User> findByEmailEndsWith(String userName, Pageable pageable);
}
